<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" type="text/html" charset="UTF-8">
</head>
<body>

<p>点击按钮查看输入的对话框。</p>

<button onclick="myFunction()">点我</button>

<p id="demo"></p>

<script>
function myFunction()
{
var x;

var person=prompt("请输入你的名字","Harry Potter");

if (person!=null)
  {
  x="你好 " + person + "! 今天感觉如何?";
  document.getElementById("demo").innerHTML=x;
  }
}
</script>

</body>
</html>